﻿/*
 * Created by SharpDevelop.
 * User: Michael
 * Date: 13/09/2013
 * Time: 8:18 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Timers;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using AdvGenContact.Data.Serialization;
using AdvGenContatct.Views;

namespace AdvGenContact.WPF
{
	/// <summary>
	/// Interaction logic for Window1.xaml
	/// Our Project Sponsor - AdvanGeneration - A BRISBANE WEB DEVELOPMENT COMPANY
	/// </summary>
	public partial class MainWindow :BaseWindow ,IMainWindowView
	{
		public MainWindow() :base()
		{
			InitializeComponent();
		
			
			// Test
			 TreeViewItem just = new TreeViewItem() { Header = "JUST" };
			 TreeViewItem tom = new TreeViewItem() { Header = "TOM" };
			 just.Items.Add(tom);
			 this.treeView.Items.Add(just);

			this.leftPanel.AfterCollapsed += new RoutedEventHandler(MainWindow_AfterCollapsed);
			this.leftPanel.AfterExpanded += new RoutedEventHandler(MainWindow_AfterExpanded);
		
		}
		
	
		void MainWindow_AfterExpanded(object sender, RoutedEventArgs e)
		{
			mainGrid.ColumnDefinitions[0].Width= new GridLength(100);
			
			
		
		}


		void timer_Elapsed(object sender, ElapsedEventArgs e)
		{
			mainGrid.ColumnDefinitions[0].Width= new GridLength(50);
		
		}

		void MainWindow_AfterCollapsed(object sender, RoutedEventArgs e)
		{
			mainGrid.ColumnDefinitions[0].Width= new GridLength(0);
			GridButton.Visibility= Visibility.Visible;
		
		}

	

		public void lnkAds_Click(object sender, RoutedEventArgs e)
		{
			
			System.Diagnostics.Process.Start("https://secure.avangate.com/order/checkout.php?PRODS=4605220&QTY=1&AFFILIATE=57076&CART=1");
		}
		void GridButton_Click(object sender, RoutedEventArgs e)
		{
			leftPanel.Expand();
			GridButton.Visibility=Visibility.Collapsed;
			mainGrid.ColumnDefinitions[0].Width= new GridLength(50);
		}
		void MenuItem_Click(object sender, RoutedEventArgs e)
		{
			GobalData.People = new List<AdvGenContact.Data.IPerson>();
			GobalData.SaveAs("test1.txt");
		
		}
		public void AddPerson (){
			
		}
		public void AddGroup() {
			
		}
		public void ListPeople () {
			
		}
		public void ListGroups () {
			
		}
	}
}